﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 工厂模式
{
    /// <summary>
    /// 工厂子类实现枚举
    /// </summary>
    enum FyType
    {
        /// <summary>
        /// 无定义
        /// </summary>
        Undefined=-1,

        
        Rectangle,

        Square,

        Circle
    }

    /// <summary>
    /// 子类实现1
    /// </summary>
    class Rectangle :Shape, IShape
    {
        public void draw()
        {
            Console.WriteLine("实现方式no1");
        }



        /// <summary>
        /// 正常收费
        /// </summary>
        /// <param name="money"></param>
        /// <returns></returns>
        public override double draw(double money)
        {
            Console.WriteLine(money);
            return money;
        }

        public void Rectangles()
        {
            Console.WriteLine("Rectangle 扩展方法");
        }

    }

    /// <summary>
    /// 子类实现2
    /// </summary>
    class Square : Shape,IShape
    {
        public void draw()
        {
            Console.WriteLine("实现方式no2");
        }
        /// <summary>
        /// 8折收费
        /// </summary>
        /// <param name="money"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public override double draw(double money)
        {
            Console.WriteLine(money*.8);
            return money * .8;
        }

        public void Squares()
        {
            Console.WriteLine("Square 扩展方法");
        }
    }

    /// <summary>
    /// 子类实现2
    /// </summary>
    class Circle : Shape,IShape
    {
        public void draw()
        {
            Console.WriteLine("实现方式no3");
        }
        public void Circles()
        {
            Console.WriteLine("Circle 扩展方法");
        }

        public override double draw(double money)
        {
            if (money>=300)
            {
                money = money - 100;
                Console.WriteLine(money);
            }
            return money;
        }
    }
}
